package org.gdpu.model;

import javax.persistence.*;
import java.util.HashSet;
import java.util.Set;

/**
 * 用户权限组
 */

@Entity
public class Groups {
    /**
    权限组名称
     */
    private String groupName;
    /**
    权限组用户
    */
    private Set<Person> persons = new HashSet<Person>(0);

    public Groups() {
    }

    public Groups(String groupName) {
        this.groupName = groupName;
    }

    @Id
    @Column(name = "groupName", unique = true, nullable = false, length = 60)
    public String getGroupName() {
        return groupName;
    }

    public void setGroupName(String groupName) {
        this.groupName = groupName;
    }

    @OneToMany(cascade = CascadeType.ALL, fetch = FetchType.LAZY, mappedBy = "groups")
    public Set<Person> getPersons() {
        return persons;
    }

    public void setPersons(Set<Person> persons) {
        this.persons = persons;
    }
}
